home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Over 1,000 Windows 95 Programs
/
Over 1000 Windows 95 Programs (Microforum) (Disc 1).iso
/
0774
/
pfw.ms_
/
pfw.ms
Wrap
Text File
|
1997-04-10
|
16KB
|
557 lines
'**************************************************************************
'* Elementrix Setup 1
'**************************************************************************
''$DEFINE DEBUG ''Define for script development/debugging
'$INCLUDE 'setupapi.inc'
'$INCLUDE 'msdetect.inc'
''Dialog ID's
CONST WELCOME = 100
CONST ASKQUIT = 200
CONST DESTPATH = 300
CONST EXITFAILURE = 400
CONST EXITQUIT = 600
CONST EXITSUCCESS = 700
CONST EXITRESTART = 750
CONST OPTIONS = 800
CONST APPHELP = 900
CONST BADPATH = 6400
CONST BILLBOARD1 = 9001
CONST BILLBOARD2 = 9002
CONST BILLBOARD3 = 9003
CONST BILLBOARD4 = 9004
CONST TRUE = -1
CONST FALSE = 0
''Bitmap ID
CONST LOGO = 1
GLOBAL OPTCUR$ ''Option selection from option dialog.
GLOBAL DestDrive$
GLOBAL PRODUCTNAME$
GLOBAL WinDrive$
'' temprorary constants
CONST NORMAL_MODE = 0
CONST ADMIN_MODE = 1
CONST NETWORK_MODE = 2
CONST COVLIST = 265
CONST FLTLIST = 285
CONST MSPNODISK = 17
CONST NoOfSTATUS = 7
CONST ALL = 0
CONST WS_VISIBLE=&H10000000
CONST WS_BORDER =&H00800000
CONST WS_CLIPCHILDREN =&H02000000
CONST GWL_STYLE =-16
CONST SW_SHOWMAXIMIZED=3
GLOBAL CUIDLL$
GLOBAL SOURCE$
GLOBAL DEST$ '' default setup directory
GLOBAL DLGRET$
CONST MaxDrive = 2
CONST WindowsDrive = 0
GLOBAL CHECKSTATES$
GLOBAL STATUSTEXT$
GLOBAL DRIVETEXT$
GLOBAL HELPPROC$
GLOBAL SETUP_MODE%
GLOBAL FINCUST%
GLOBAL RB%
'' end of temproraty constants
DECLARE SUB Install
DECLARE SUB QuitProc
DECLARE FUNCTION CheckSpace () AS INTEGER
DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
'' Function declarations
DECLARE FUNCTION WinVersion(MajorVer%, MinorVer%) AS INTEGER
DECLARE FUNCTION ShowWindow LIB "user.exe" (hWnd%,iShow%) AS INTEGER
DECLARE FUNCTION SetWindowLong LIB "user.exe" (hWnd%, offset%, style&) AS LONG
DECLARE FUNCTION EXRefreshExpirationData LIB "mscuistf.dll" (Dest$,Source$) AS INTEGER
DECLARE FUNCTION EXVSetExpirationData LIB "mscuistf.dll" (Dest$, pid%, expdays%, bombdays%) AS INTEGER
DECLARE FUNCTION Ctl3dRegister LIB "ctl3d.dll" (hinstance%) AS INTEGER
DECLARE FUNCTION Ctl3dUnregister LIB "ctl3d.dll" (hinstance%) AS INTEGER
DECLARE FUNCTION Ctl3dAutoSubclass LIB "ctl3d.dll" (hinstance%) AS INTEGER
'' 1- function dec
DECLARE SUB CallDlg(DlgIDNo%, DlgProc$, HelpIDNo%)
'' 2-funciton dec
DECLARE FUNCTION GETPATH(DefaultPath$, DlgTextID%) AS STRING
INIT:
PRODUCTNAME$ = "Personal FireWall 2.0 Beta"
CUIDLL$ = "mscuistf.dll" ''Custom user interface dll
'' HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure
i% = Ctl3dRegister (HinstFrame ())
i% = Ctl3dAutoSubclass (HinstFrame ())
hWnd% = HwndFrame()
k& = SetWindowLong(hWnd%,GWL_STYLE,WS_VISIBLE + WS_BORDER + WS_CLIPCHILDREN)
i% = ShowWindow(hWnd%,SW_SHOWMAXIMIZED)
SetBitmap CUIDLL$, LOGO
'' i% = DoMsgBox(" till now", "DEBUG", MB_OK) ''************************
SetTitle PRODUCTNAME$ + " Setup"
i% = SetDecompMode(1)
'' Check the windows version
IF WinVersion(3,10) THEN
ELSE
ERR = VERERR
GOTO VERERRQUIT
END IF
'' Check the network presens , set the appropriate mode
IF GetSymbolValue("STF_MODE") = "ADMIN" THEN
SETUP_MODE = ADMIN_MODE
ELSEIF GetSymbolValue("STF_MODE") = "NETWORK" THEN
SETUP_MODE = NETWORK_MODE
ELSE
SETUP_MODE = NORMAL_MODE
END IF
'' Get the INF file path
szInf$ = GetSymbolValue("STF_SRCINFPATH")
IF szInf$ = "" THEN
szInf$ = MakePath(GetSymbolValue("STF_CWDDIR"),"pfw.INF")
END IF
ReadInfFile szInf$
szInf$ = ""
'' OPTCUR$ = "1"
'' set source and destination drives and path
WinDrive$ = MID$(GetWindowsDir, 1, 1)
IF IsDriveValid(WinDrive$) = 0 THEN
i% = DoMsgBox("Windows drive ('"+WinDrive$+"') is not a valid drive.", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
GOTO QUIT
END IF
SOURCE$ = GetSymbolValue("STF_SRCDIR")
IF SETUP_MODE = NETWORK_MODE THEN
SourceDll$ = MakePath(SOURCE$,"DLL")
DEST$ = SOURCE$
ELSE
SourceDll$ = SOURCE$
DEST$ = WinDrive$ + ":\ELMNTRIX\FIREWALL"
END IF
WELCOME:
sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSE
'$IFDEF DEBUG
i% = DoMsgBox(" wrong welcome ", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
'$ENDIF ''DEBUG
GOSUB ASKQUIT
GOTO WELCOME
END IF
'$IFDEF DEBUG
i% = DoMsgBox("After welcome ", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
'$ENDIF ''DEBUG
DEST$ = GETPATH(DEST$, DESTPATH)
'$IFDEF DEBUG
i% = DoMsgBox("The Path is ('"+DEST$+"') ", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
'$ENDIF ''DEBUG
IF CheckSpace() = FALSE THEN
DEST$ = GETPATH(DEST$, DESTPATH)
END IF
'$IFDEF DEBUG
i% = DoMsgBox("Afeter check space ", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
'$ENDIF ''DEBUG
Install
' ******************************************************************************
QUIT:
'$IFDEF DEBUG
sss$=str$(err)
i% = DoMsgBox(sss$, "error number", MB_TASKMODAL+MB_OK)
'$ENDIF ''DEBUG
'$IFDEF DEBUG
i% = DoMsgBox("QUIT: label", "DEBUG", MB_TASKMODAL+MB_OK)
'$ENDIF ''DEBUG
ON ERROR GOTO ERRQUIT
IF ERR = 0 THEN
IF RestartListEmpty() = 0 THEN
dlg% = EXITRESTART
'$IFDEF DEBUG
i% = DoMsgBox("dlg% = EXITRESTART", "DEBUG", MB_TASKMODAL+MB_OK)
'$ENDIF ''DEBUG
ELSE
dlg% = EXITSUCCESS
'$IFDEF DEBUG
i% = DoMsgBox("dlg% = EXITSUCCESS", "DEBUG", MB_TASKMODAL+MB_OK)
'$ENDIF ''DEBUG
END IF
ELSEIF ERR = STFQUIT THEN
dlg% = EXITQUIT
'$IFDEF DEBUG
i% = DoMsgBox("dlg% = EXITQUIT", "DEBUG", MB_TASKMODAL+MB_OK)
'$ENDIF ''DEBUG
ELSE
dlg% = EXITFAILURE
'$IFDEF DEBUG
i% = DoMsgBox("dlg% = EXITFAILURE", "DEBUG", MB_TASKMODAL+MB_OK)
'$ENDIF ''DEBUG
END IF
QUITL1:
'$IFDEF DEBUG
i% = DoMsgBox("QUITL1: label", "DEBUG", MB_TASKMODAL+MB_OK)
'$ENDIF ''DEBUG
UIPopAll
sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO QUITL1
END IF
UIPop 1
IF dlg% = EXITRESTART THEN
j% = ExitExecRestart()
END IF
'$IFDEF DEBUG
i% = DoMsgBox("After QUITL1: before END", "DEBUG", MB_TASKMODAL+MB_OK)
'$ENDIF ''DEBUG
i% = Ctl3dUnregister (HinstFrame ()) '' Bob for 3d-look
END
ERRQUIT:
'$IFDEF DEBUG
i% = DoMsgBox("ERRQUIT: label", "DEBUG", MB_TASKMODAL+MB_OK)
'$ENDIF ''DEBUG
i% = DoMsgBox("Setup sources were corrupted, call ZDBOp!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
'$IFDEF DEBUG
i% = DoMsgBox("After ERRQUIT: before END", "DEBUG", MB_TASKMODAL+MB_OK)
'$ENDIF ''DEBUG
i% = Ctl3dUnregister (HinstFrame ()) '' Bob for 3d-look
END
VERERRQUIT:
'$IFDEF DEBUG
i% = DoMsgBox("ERRQUIT: label", "DEBUG", MB_TASKMODAL+MB_OK)
'$ENDIF ''DEBUG
i% = DoMsgBox("This version of FireWall works only with WINDOWS 3.1X", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
'$IFDEF DEBUG
i% = DoMsgBox("After ERRQUIT: before END", "DEBUG", MB_TASKMODAL+MB_OK)
'$ENDIF ''DEBUG
i% = Ctl3dUnregister (HinstFrame ()) '' Bob for 3d-look
END
BADPATH:
'$IFDEF DEBUG
i% = DoMsgBox("BADPATH: label", "DEBUG", MB_TASKMODAL+MB_OK)
'$ENDIF ''DEBUG
sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO BADPATH
END IF
UIPop 1
RETURN
ASKQUIT:
'$IFDEF DEBUG
i% = DoMsgBox("ASKQUIT: label", "DEBUG", MB_TASKMODAL+MB_OK)
'$ENDIF ''DEBUG
sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
IF sz$ = "EXIT" THEN
UIPopAll
'$IFDEF DEBUG
i% = DoMsgBox("ASKQUIT: before ERROR STFQUIT", "DEBUG", MB_TASKMODAL+MB_OK)
'$ENDIF ''DEBUG
ERROR STFQUIT
ELSEIF sz$ = "REACTIVATE" THEN
GOTO ASKQUIT
ELSE
UIPop 1
END IF
RETURN
'**
'** Purpose:
'** Builds the copy list and performs all installation operations.
'** Arguments:
'** none.
'** Returns:
'** none.
'*************************************************************************
STATIC FUNCTION CheckSpace() AS INTEGER
SrcDir$ = GetSymbolValue("STF_SRCDIR")
ClearCopyList
AddSectionFilesToCopyList "Files", SrcDir$, DEST$
AddSectionFilesToCopyList "EXVer", SrcDir$, GetWindowsDir()
FOR i% = 1 TO 26 STEP 1
AddListItem "EXTRA", "0"
NEXT i%
'$IFDEF DEBUG
i% = DoMsgBox("In the Check Space ", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
i% = DoMsgBox("win drive% = ('"+WinDrive$+"') ", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
i% = DoMsgBox("dest drive% = ('"+DestDrive$+"') ", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
'$ENDIF ''DEBUG
wd% = ASC(ucase$(WinDrive$)) - ASC("A") + 1
dd% = ASC(ucase$(DestDrive$)) - ASC("A") + 1
ReplaceListItem "EXTRA", wd%, "10240"
spaceNeeded& = GetCopyListCost("EXTRA","COST","NEEDED")
'$IFDEF DEBUG
i% = DoMsgBox("The Space Needed is ('"+STR$(spaceNeeded&)+"') ", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
'$ENDIF ''DEBUG
IF spaceNeeded& = 0 THEN
CheckSpace = TRUE
ELSE
CheckSpace = FALSE
w& = VAL(GetListItem("NEEDED",wd%))
d& = VAL(GetListItem("NEEDED",dd%))
m$ = "There is not enough disk space to install Personal FireWall"
IF d& > 0 THEN
m$ = m$ + CHR$(10) + CHR$(10)
m$ = m$ + "You need an additional " + STR$((d&+999)/1000) + " kilobytes on drive " + DestDrive$ + "."
m$ = m$ + " Choose another installation drive, or free additional space on drive " + DestDrive$ + "."
END IF
IF (w& > 0) AND (wd% <> dd%) THEN
m$ = m$ + CHR$(10) + CHR$(10)
m$ = m$ + "You must free an additional " + STR$((w&+999)/1000) + " kilobytes on drive " + WinDrive$
m$ = m$ + " before installing Personal FireWall."
END IF
i% = DoMsgBox(m$,"Insufficient Disk Space",MB_TASKMODAL+MB_OK+MB_ICONHAND)
END IF
END FUNCTION
STATIC SUB Install
'$IFDEF DEBUG
i% = DoMsgBox("Starting Install - CUIDLL ('"+CUIDLL$+"') ", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
'$ENDIF ''DEBUG
CreateDir DEST$, cmoNone
SetRestartDir DEST$
''AddToBillboardList CUIDLL$, BILLBOARD1, "FModeless0DlgProc", 1
''AddToBillboardList CUIDLL$, BILLBOARD2, "FModeless0DlgProc", 1
''AddToBillboardList CUIDLL$, BILLBOARD3, "FModeless0DlgProc", 1
SetCopyGaugePosition 140, 160
CopyFilesInCopyList
''---------------------------------------------------------------------------------------
'' Bob: this func from mscuistf.dll copies all tion data from diskette to hard
''
SrcDir$ = GetSymbolValue("STF_SRCDIR")
' i% = EXRefreshExpirationData (MakePath(GetWindowsDir(),"exver.cfg"), MakePath(SrcDir$,"exver.cfg"))
i% = EXVSetExpirationData (MakePath(GetWindowsDir(),"exver.cfg"), 8, 30, 45)
CreateProgmanGroup "Personal FireWall 2.0 beta", MakePath(GetWindowsDir(), "pfw.grp"), cmoNone
'$IFDEF DEBUG
i% = DoMsgBox("GroupCreated ('"+MakePath(GetWindowsDir(), "pfw.grp"), "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
'$ENDIF ''DEBUG
ShowProgmanGroup "Personal FireWall 2.0 beta", 1, cmoNone
CreateProgmanItem "Personal FireWall 2.0 beta","RuleBase Manager", MakePath(DEST$,"fwmanage.exe"), "", cmoOverwrite
CreateProgmanItem "Personal FireWall 2.0 beta","FireWall Config", MakePath(DEST$,"fwconfig.exe"), "", cmoOverwrite
'' CreateProgmanItem "Personal FireWall 2.0 beta","FireWall Unlodad/Reload", MakePath(DEST$,"fwsetup.exe"), "", cmoOverwrite
CreateProgmanItem "Personal FireWall 2.0 beta","Log Viewer", MakePath(DEST$,"fwviewer.exe"), "", cmoOverwrite
CreateProgmanItem "Personal FireWall 2.0 beta","Personal FireWall", MakePath(DEST$,"fwfilter.exe"), "", cmoOverwrite
END SUB
'**
'** Purpose:
'** Appends a file name to the end of a directory path,
'** inserting a backslash character as needed.
'** Arguments:
'** szDir$ - full directory path (with optional ending "\")
'** szFile$ - filename to append to directory
'** Returns:
'** Resulting fully qualified path name.
'*************************************************************************
FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
IF szDir$ = "" THEN
MakePath = szFile$
ELSEIF szFile$ = "" THEN
IF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
MakePath = MID$(szDir$, 1, LEN(szDir$)-1)
ELSE
MakePath = szDir$
END IF
ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
MakePath = szDir$ + szFile$
ELSE
MakePath = szDir$ + "\" + szFile$
END IF
END FUNCTION
'' ---------------------------------------------------------------------------------------
FUNCTION WinVersion(MajorVer%, MinorVer%) STATIC AS INTEGER
VerMaj% = GetWindowsMajorVersion()
VerMin% = GetWindowsMinorVersion()
'$IFDEF DEBUG
sss$="windows version: "+str$(VerMaj%)+"."+str$(VerMin%)
i% = DoMsgBox(sss$, "DEBUG - windows version", MB_TASKMODAL+MB_OK)
'$ENDIF ''DEBUG
IF (VerMaj% > MajorVer%) OR ((VerMaj% = MajorVer%) AND (VerMin% >= MinorVer%)) THEN
WinVersion = TRUE
ELSE
WinVersion = FALSE
END IF
END FUNCTION
'' -----------------------------------------------------------------------------------
SUB CallDlg(DlgIDNo%, DlgProc$, HelpIDNo%) STATIC
SetSymbolValue "DlgID", STR$(DlgIDNo%)
DLGRET$ = UIStartDlg(CUIDLL$, DlgIDNo%, DlgProc$, HelpIDNo%, HELPPROC$)
RemoveSymbol "DlgID"
END SUB
STATIC FUNCTION GETPATH(DefaultPath$, DlgTextID%) AS STRING
SetSymbolValue "EditTextIn", DefaultPath$
SetSymbolValue "EditFocus", "END"
NewPath$ = DefaultPath$
WHILE 1
SetSymbolValue "FInCust", STR$(FINCUST%)
CallDlg DESTPATH, "FEditDlgProc", HELPPATH
RemoveSymbol "FInCust"
SELECT CASE DLGRET$
CASE "CONTINUE"
NewPath$ = GetSymbolValue("EditTextOut")
DestDrive$ = MID$(NewPath$, 1, 1)
IF IsDirWritable(NewPath$) = 0 THEN
WHILE 1
CallDlg BADPATH, "FInfo0DlgProc", APPHELP
IF DLGRET$ <> "REACTIVATE" THEN
EXIT WHILE
END IF
WEND
UIPop 1
ELSE
GOTPATH:
UIPop 1
GETPATH = NewPath$
EXIT WHILE
END IF
CASE "REACTIVATE"
CASE ELSE
IF FINCUST% = 1 THEN
UIPop 1
GETPATH = DefaultPath$
EXIT WHILE
END IF
QuitProc
END SELECT
WEND
RemoveSymbol "EditTextIn"
RemoveSymbol "EditFocus"
DefaultPath$ = ""
NewPath$ = ""
END FUNCTION
SUB QuitProc STATIC
'$IFDEF DEBUG
i% = DoMsgBox("in QuitProc", "DEBUG", MB_TASKMODAL+MB_OK)
'$ENDIF ''DEBUG
WHILE 1
CallDlg ASKQUIT, "FQuitDlgProc", APPHELP
IF DLGRET$ = "EXIT" THEN
UIPopAll
'$IFDEF DEBUG
i% = DoMsgBox("QuitProc: ERROR STFQUIT", "DEBUG", MB_TASKMODAL+MB_OK)
'$ENDIF ''DEBUG
ERROR STFQUIT
ELSE
UIPop 1
EXIT WHILE
END IF
WEND
END SUB